package com.upcode.weighing.vo.req.app;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.apache.commons.lang3.StringUtils;

public class BannerAddEditReqVo {

    /**
     * 主键
     */
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;

    /**
     * 标题
     */
    private String name;

    /**
     * 图片ID
     */
    private String fileId;

    /**
     * 所有模块（字典）
     */
    private Long model;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * banner跳转链接
     */
    private String bannerLink;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getFileId() {
        return fileId;
    }

    public void setFileId(String fileId) {
        this.fileId = fileId;
    }

    public Long getModel() {
        return model;
    }

    public void setModel(Long model) {
        this.model = model;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getBannerLink() {
        return bannerLink;
    }

    public void setBannerLink(String bannerLink) {
        this.bannerLink = bannerLink;
    }

    public String checkParams(int checkType){
        if(checkType == 1 && null == id){
            return "id不可为空";
        }
        if(null == model){
            return "请选择轮播类型";
        }
        if(StringUtils.isBlank(name)){
            return "轮播标题不可为空";
        }
        if(null == sort){
            return "请选择轮播序号";
        }
        if(StringUtils.isBlank(fileId)){
            return "请上传图片";
        }
        return null;
    }
}
